'''
创建多个子进程
'''
from multiprocessing import Process
from time import sleep
import os, sys


def th(sec, thing):
    sleep(sec)
    print(thing)
    print(os.getppid(), '-->', os.getpid())


job = []
for i in [(2, '吃饭'), (5, '睡觉'), (4, '打豆豆')]:
    process = Process(target=th, args=i)
    job.append(process)
    process.start()

# 所有进程都结束
for i in job:
    i.join()
print('事件执行完毕')
